package com.zheng.study.base.bean.search.projection;

import com.zheng.study.base.bean.search.SearchEnum;

/**
 * 查询 - 参数 - Projection
 * ============================================================================
 * author : fallenpanda
 * createDate:  2018/6/11 。
 * ============================================================================
 */
public abstract class Projection {

	protected final SearchEnum.ProjectionType projectionType;

	protected Projection(SearchEnum.ProjectionType projectionType) {
		this.projectionType = projectionType;
	}

	public SearchEnum.ProjectionType getProjectionType() {
		return projectionType;
	}

	public abstract static class Builder<T extends Projection, B extends Builder<T, B>>{

		private B theBuilder;

		protected SearchEnum.ProjectionType projectionType;

		protected Builder(){
			theBuilder = getThis();
		}

		protected abstract B getThis();

		public B setProjectionType(SearchEnum.ProjectionType projectionType) {
			this.projectionType = projectionType;
			return theBuilder;
		}

		public abstract T build();
	}

}
